package com.wlj.rabbit.util;


import java.io.Serializable;

/**
 * Created by GeGe on 2018/4/12.
 */
public class ResultEntity<T> implements Serializable {

	private static final long serialVersionUID = 1L;
	
	//操作是否成功
    public Boolean success;
    //返回信息
    public String message;
    //操作编码
    public int code;
    //返回数据
    public T data;
    
    public static ResultEntity<?> SUCCESS = new ResultEntity<>(null);

    public ResultEntity() {
    }
    
    public ResultEntity(T data) {
        this(true, ResultCodeEumn.SUCCESS, data);
    }
    public ResultEntity(Boolean success, ResultCodeEumn code, T data) {
        this(success, code.getDesc(), code, data);
    }
    
    public ResultEntity(Boolean success, ResultCodeEumn code){
    	this.success=success;
    	this.code=code.getCode();
    }

    public ResultEntity(Boolean success, String message, ResultCodeEumn code, T data) {
        this.success = success;
        this.message = message;
        this.code = code.getCode();
        this.data = data;
    }


    public Boolean getSuccess() {
        return success;
    }

    public void setSuccess(Boolean success) {
        this.success = success;
    }

    public boolean isSuccess() {
        return success;
    }

    public void setSuccess(boolean success) {
        this.success = success;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }
}